home *** CD-ROM | disk | FTP | other *** search
- LISTING 14 - More Form member functions
- // form.cpp
-
- #include <assert.h>
- #include "form.h"
- #include "field.h"
-
- int Form::add(Field *fp)
- {
- assert(fp);
- if (nfields >= MAXFIELDS)
- return -1;
-
- fields[nfields] = fp;
- return nfields++;
- }
-
- Form::~Form()
- {
- // Assumes fields are on heap
- for (int i = 0; i < nfields; ++i)
- delete fields[i];
- }
-
-